<template>
  <div class="status-panel">
    <div class="status-title">运行状态</div>
    <div class="status-item">
      <span>舱室压力</span>
      <a-progress type="circle" :percent="status.pressure" :show-info="true" size="small" />
    </div>
    <div class="status-item">
      <span>基板温度</span>
      <a-progress type="circle" :percent="status.temperature" :show-info="true" size="small" />
    </div>
    <div class="status-item">
      <span>氧含量</span>
      <a-progress type="circle" :percent="status.oxygen" :show-info="true" size="small" />
    </div>
    <div class="status-item">
      <span>过滤器氧含量</span>
      <a-progress type="circle" :percent="status.filterOxygen" :show-info="true" size="small" />
    </div>
    <div class="status-item">
      <span>风速</span>
      <a-progress type="circle" :percent="status.windSpeed" :show-info="true" size="small" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { defineProps } from 'vue'
const { status } = defineProps<{
  status: {
    pressure: number
    temperature: number
    oxygen: number
    filterOxygen: number
    windSpeed: number
  }
}>()

// 预留后端接口对接（如需组件内自拉数据可开放）
// async function fetchStatus() {}
</script>

<style scoped>
.status-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 160px;
  min-width: 120px;
  max-width: 220px;
  height: 100vh;
  background: #fafbfc;
  border-radius: 1.2rem 0 0 1.2rem;
  box-shadow: 0 2px 8px #eee;
  padding: 2rem 0.5rem 2rem 0.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.status-title {
  font-size: 1.3rem;
  font-weight: bold;
  color: #108ee9;
  margin-bottom: 2.5rem;
  text-align: center;
  padding-top: 0.5rem;
}
.status-item {
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.status-item:last-child {
  margin-bottom: 0;
}
.status-item span {
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 0.5rem;
}
:deep(.ant-progress-circle) {
  font-size: 1.2em !important;
}
/* 假设有用户信息区域 */
.user-info {
  font-size: 1.2em;
  color: #108ee9;
  margin-left: 2vw;
  font-weight: 500;
  letter-spacing: 0.05em;
}
@media (max-width: 1200px) {
  .status-panel {
    width: 12vw;
    min-width: 70px;
    padding: 1rem 0.2rem 1rem 0.2rem;
  }
  .status-title {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
  }
  .status-item {
    margin-bottom: 1.5rem;
  }
}
@media (max-width: 800px) {
  .status-panel {
    position: static;
    width: 100vw;
    min-width: 0;
    max-width: none;
    border-radius: 0.7rem;
    flex-direction: row;
    justify-content: space-around;
    padding: 0.5rem 0.2rem;
  }
  .status-title {
    display: none;
  }
  .status-item {
    margin-bottom: 0;
    margin-right: 1.2rem;
    flex: 1;
  }
}
</style>
